/******************************************************************************
 *
 * @file       customizeedit.h
 * @brief      自定义输入框
 *
 * @author     ario
 * @date       2024/08/08
 * @history
 *****************************************************************************/

#ifndef CUSTOMIZEEDIT_H
#define CUSTOMIZEEDIT_H

#include <QLineEdit>
#include <QObject>

class CustomizeEdit : public QLineEdit
{
    Q_OBJECT
public:
    CustomizeEdit(QWidget *parent = nullptr);
    ~CustomizeEdit();

    void SetMaxLength(int maxLen);

protected slots:
    // 输入框失去焦点
    void focusOutEvent(QFocusEvent * event) override;

private:
    void limitTextLength(QString text);

private:
    int _max_len;

signals:
    void sig_focus_out();

};

#endif // CUSTOMIZEEDIT_H
